PH345: Winter 2025
Fatal Accident Reporting System (FARS)
Data from National Highway Traffic Safety Administration (NHTSA) on fatal traffic accidents in the US
Collected and reported annually from 1975. Most recent year available is 2022
Data are available at https://www.nhtsa.gov/file-downloads?p=nhtsa/downloads/FARS/2022/National/
For each state, I calculated the fraction of accidents that occurred in daylight and fraction of accidents that occurred in clear weather and compare across states.
Three big problems with this plot:
What previous plot looks like to someone with 80% deuteranopia (can’t see green well)
Grouping by region instead of individual states
Labeling outlying states explicitly using ggrepel R package (Slowikowski, 2024)
Color can be defined by its hue (the defining attribute, e.g. blue or red), lightness (the brightness), and chroma (the richness of a color),
American cartographer and professor of geography at Penn State University
Pioneering work in developing color schemes for maps (https://colorbrewer2.org)
Recipient of the Carl Mannerfelt Gold Medal in 2023
Instead of choosing individual colors, typically use predefined ‘palette’ of colors. Three types of palettes:
Many palettes available in R, including ggplot2
ggplot2Set3 palette (qualitative)Dark2 palette (qualitative)Spectral palette (diverging)BrBG palette (qualitative)Perception of color can vary. (a,b) The same color can look different (a), and different colors can appear to be nearly the same by changing the background color (b)1. (c) The rectangles in the heat map indicated by the asterisks (*) are the same color but appear to be different.
Figure 1 from Wong (2010a)
Ignoring color blindness
Too Much Information
Misleading comparisons
Color scales
Slowikowski K, 2024. ggrepel: Automatically Position Non-Overlapping Text Labels with ‘ggplot2’. R package version 0.9.5, https://CRAN.R-project.org/package=ggrepel.
Wilke, C.O., 2019. Fundamentals of data visualization: a primer on making informative and compelling figures. O’Reilly Media.
Wong, B., 2010. Color coding. Nature Methods, 7(8), pp.573.
Wong, B., 2011. Color blindness. Nature Methods, 8(6), pp.441.